// 行末按钮配置
import {getModelingList} from "@/api/barcodeprint/mesProdBarcodeReprint";
import {getDict} from "@/api/common";
import {getPrinttypeList} from "@/api/print/mesCapacityCodePrintingRecord";

export const rowConfig = [
  {
    name: '确认',
    type: 'primary',
    class: 'row-btn-primary',
    handleName: 'edit' // 点击时返回的标识
  }
]
// 搜索条件配置
export const searchConfig = {
  data() {
    const self = this
    return {
      searchDialog: {
        inline: true,
        formDesc: {
          orderCode: {
            type: 'input',
            label: '订单号'
          },
          vinCode: {
            type: 'input',
            label: 'VIN'
          },
          modelName: {
            type: 'input',
            label: '车型'
          },
        }
      }
    }
  }
}
// 新增/删除表单配置
export const formDescDialogMixin = {
  data() {
    const self = this
    return {
      formDescDialog: {
        span: 24,
        labelPosition: 'top',
        formDesc: {
          // customerName: {
          //   type: 'input',
          //   label: '客户名称',
          //   layout: 6,
          //   attrs: { readonly: true }
          // },
          // customerId: {
          //   type: 'input',
          //   label: '客户编号',
          //   layout: 6,
          //   attrs: { readonly: true }
          // },
          // customerContact: {
          //   type: 'input',
          //   label: '客户联系人',
          //   layout: 6,
          //   attrs: { readonly: true }
          // },
          // customerPhone: {
          //   type: 'input',
          //   label: '客户联系电话',
          //   layout: 6,
          //   attrs: { readonly: true }
          // },
          orderCode: {
            type: 'input',
            label: '订单编号',
            layout: 6,
            attrs: { readonly: true }
          },
          modelName: {
            type: 'input',
            label: '车型',
            layout: 6,
            attrs: { readonly: true }
          },
          modelColor: {
            type: 'input',
            label: '车身颜色',
            layout: 6,
            attrs: { readonly: true }
          },
          vinCode: {
            type: 'input',
            label: 'VIN码',
            layout: 6,
            attrs: { readonly: true }
          },
          materialList: {
            label: '待确认项',
            layout: 24,
            type: 'table-editor',
            attrs: {
              // 校检规则
              isShowDelete:false,
              isShowAdd: false,
              // 表格列
              // extraBtns: [
              //   {
              //     text: "查看图片",
              //     attrs: {
              //       type: "text",
              //     },
              //     style: {
              //       color: '#6caaf5'
              //     },
              //     click(scope) {
              //       self.viewPic(scope.row.materialPhotoUrl)
              //     }
              //   },
              // ],
              // rules: {
              //   materialNum: { required: true, message: '请输入物料用量' },
              // },
              //   字段已对完
              columns: [
                {
                  // el-table-column 的属性
                  type: 'index',
                  width: 50
                },
                {
                  prop: 'orderCode',
                  label: '工单号',
                  showOverflowTooltip: true
                },
                {
                  prop: 'partsName',
                  label: '部件',
                  showOverflowTooltip: true
                },
                {
                  prop: 'materialName',
                  label: '物料名称',
                  showOverflowTooltip: true
                },
                {
                  prop: 'materialType',
                  label: '类型',
                  showOverflowTooltip: true
                },
                {
                  prop: 'materialNum',
                  label: '物料用量',
                  content: {
                    attrs: ({ row }) => {
                      return {
                        placeholder: $i18n.t("mesProdBom.inputQuantity"),
                        min: 1,
                        disabled: row.orderStateOg !== "0",
                      };
                    },
                    // type 可以为全局注册的组件名或者组件引用
                    type: "el-input-number",
                    // attrs 是组件的属性
                  },
                },
                {
                  prop: "brand",
                  label: "品牌",
                  width: 180,
                  showOverflowTooltip: true,
                  content: {
                    attrs: ({ row }) => {
                      return {
                        filterable:true,
                        disabled: row.orderStateOg !== "0",
                      };
                    },
                    type: "el-select",
                    options: ({ row }) => {
                      return row.materialBrandList
                    }
                  },

                },
                {
                  prop: 'materialUnit',
                  label: '物料规格',
                  content: {
                    // type 可以为全局注册的组件名或者组件引用
                    type: "el-input",
                    // attrs 是组件的属性
                    attrs: ({ row }) => {
                      return {
                        placeholder: "请输入物料规格",
                        disabled: row.orderStateOg !== "0",
                      };
                    },
                  },
                },
                {
                  prop: 'orderState',
                  label: '确认状态',
                  minWidth: 80,
                  content: {
                    attrs: ({ row }) => {
                      return {
                        disabled: row.orderStateOg !== "0" && row.orderStateOg !== "4",
                      };
                    },
                    type: "el-select",
                    options: [
                      {text: "待确认", value: "0" },
                      { text: "确认有货", value: "3" },
                      { text: "确认无货", value: "4" },
                    ],
                  },
                }
              ],

              // 新行默认值
              newColumnValue: {
                lineNum: 0,
                count: 0
              }
            }
          },
        }
      }
    }
  }
}
